<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>isSessionStorageEnabled</title>
</head>
<body>
    <p id="text"></p>
    <script>
        const text = document.getElementById('text');
        const isSessionStorageEnabled = () => {
            try {
                const key = `__storage__test`;
                window.sessionStorage.setItem(key,null);
                window.sessionStorage.removeItem(key);
                return true;
            } catch (e) {
                return false;
            }
        }
        text.textContent = `当前是否支持会话存储:${isSessionStorageEnabled() ? '是' : '否'}`;
    </script>
</body>
</html>